package lab01;

/**
 * Created by lady on 2017/10/12.
 */
import java.util.Scanner;
public class Test08 {

    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        int i = 100;
        int riddleNum = (int) (Math.random() * i) + 1; //一个1-100之间的整数
        System.out.println("产生的随机数:" + riddleNum);
        System.out.println("请输入你的猜测,范围在(1-100):");
        int guessNum = reader.nextInt();
        while (guessNum != riddleNum) {
            if (guessNum > riddleNum)
                System.out.println("猜大了!");
            if (guessNum < riddleNum) System.out.println("猜小了!");
            guessNum = reader.nextInt();
        }
        System.out.println("猜对了!");
    }
}




